﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace QLBenhVien
{
    class DAOBaoCao
    {
        public static DataTable getMonth(string thang, string nam)
        {
            string sql = "select * from HoaDon where (DATEPART(MONTH,ngaythanhtoan)) = @thang and (DATEPART(YEAR,ngaythanhtoan)) = @nam";
            DataTable dt = new DataTable();
            try
            {
                SqlDataAdapter da = new SqlDataAdapter(sql, DB_Provider.conn_str);
                da.SelectCommand.Parameters.Add("@thang", SqlDbType.VarChar).Value = thang;
                da.SelectCommand.Parameters.Add("@nam", SqlDbType.VarChar).Value = nam;
                da.Fill(dt);
            }
            catch (Exception ex)
            {
                throw new Exception(ex.Message);
            }
            return dt;
        }
    }
}
